package com.jxd.reportsys.service.impl;

import com.jxd.reportsys.dao.IReportMapper;
import com.jxd.reportsys.model.Report;
import com.jxd.reportsys.service.IReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * @ClassName ReportServiceImpl
 * @Description TODO
 * @Author 朱隶文
 * @Date 2024/9/19 16:48
 * @Version 1.0
 */
@Service
public class ReportServiceImpl implements IReportService {

    @Autowired
    private IReportMapper reportMapper;

    @Override
    public List<Map<String, Object>> getDeptReportSummary(int deptno, String reportdate) {
        return reportMapper.getDeptReportSummary(deptno, reportdate);
    }

    @Override
    public List<Map<String, Object>> getReport(Map<String, Object> map) {
        int page = (Integer)map.get("page");
        int limit = (Integer)map.get("limit");
        int count = (page - 1) * limit;
        map.put("count", count);
        return reportMapper.getReport(map);
    }

    @Override
    public int getCount(Map<String, Object> map) {
        return reportMapper.getCount(map);
    }

    @Override
    public boolean auditReport(Map<String, Object> map) {
        return reportMapper.auditReport(map);
    }

    @Override
    public boolean auditReportByBatch(Map<String, Object> map) {
        return reportMapper.auditReportByBatch(map);
    }

    @Override
    public  List<Map<String, Object>> getAllFailReportdate(Map<String, Object> map) {
        return reportMapper.getAllFailReportdate(map);
    }

    @Override
    public List<String> getAllReportdate(int empno, String hiredate) {
        return reportMapper.getAllReportdate(empno, hiredate);
    }

    @Override
    public Report getReportByEmpnoAndReportdate(int empno, String reportdate) {
        return reportMapper.getReportByEmpnoAndReportdate(empno, reportdate);
    }

    @Override
    public boolean addReport(Report report) {
        return reportMapper.addReport(report);
    }

    @Override
    public boolean updateReport(Report report) {
        return reportMapper.updateReport(report);
    }


}
